<template>
  <div id="app">
    <transition name="fade">
      <router-view>
      </router-view>
    </transition>
  </div>
</template>

<script>

export default {
  name: 'app',
  mounted() {
    // 创建cnzz统计js
    const script = document.createElement('script');
    script.src = 'https://s4.cnzz.com/z_stat.php?id=1280420085&web_id=1280420085';
    script.language = 'JavaScript';
    document.body.appendChild(script);

  },
  watch: {
    '$route': {
      handler(to, from) {
        setTimeout(() => { //避免首次获取不到window._czc
          if (window._czc) {
            let location = window.location;
            let contentUrl = location.pathname + location.hash;
            let refererUrl = '/';
            // 用于发送某个URL的PV统计请求，
            window._czc.push(['_trackPageview', contentUrl, refererUrl])
          }
        }, 300)
      },
      immediate: true  // 首次进入页面即执行
    }
  },
}
</script>

<style>
@import '../static/css/style.css';
@import '../static/css/classes.css';


.fade-enter-active, .fade-leave-active {
  transition: opacity 0.2s;
}

.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */
{
  opacity: 0;
}


</style>
